<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选择器</title>

    <style>
        h4 {
            color: red;
        }

        #d1 {
            width: 100px;
            height: 100px;
            background-color: yellow;
        }

        .error {
            background-color: green;
        }

        .msg {
            background-color: pink;
        }

        #d1:hover {
            background-color: red;
        }

        #d1, h4, .error {
            border: 3px solid blue;
        }

        a:link {
            color: blue;
        }

        a:visited {
            color: purple;
        }

        a:hover {
            color: skyblue;
        }

        a:active {
            color: red;
        }

        input[name="uname"] {
            background-color: pink;
        }

        * {
            font-style: italic;
        }

        #d2 span {
            color: red;
        }

        #d2 > div > p > span {
            color: blue;
        }

    </style>
</head>
<body>
<div id="d1">我是div</div>
<div>我是div</div>
<p>我是段落</p>
<h4>我是标题</h4>
<h4>我是标题</h4>
<hr>
<span class="error msg">用户名不能为空</span>
<span class="error msg">密码必须在6~12位之间</span>
<span class="success msg">手机号格式正确</span>
<span class="success msg">邮箱格式正确</span>
<hr>
<a href="https://www.baidu.com">超链接1</a>
<a href="abc">超链接2</a>
<hr>
<input type="text" name="uname">
<input type="text" name="nickname">
<select name="uname">
    <option value="1"></option>
    <option value="2"></option>
</select>
<hr>
<div id="d2">
    <span>111</span>
    <div>
        <span>222</span>
        <p>测试文字</p>
        <p>我是<span>333</span>段落</p>
    </div>
    <span>444</span>
</div>
</body>
</html>